package net.haiyue.api.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.haiyue.api.custom.JsonResult;
import net.haiyue.api.service.MenuService;
import net.haiyue.api.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Api(value = "MenuController")
@RestController
@RequestMapping(value = "/menu")
public class MenuController {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Resource
    private MenuService _service;

    @Resource
    HttpServletRequest request;
    @ApiOperation(value="根据用户权限获取菜单", notes="用于构建菜单")
    @GetMapping("/index")
    public JsonResult Index(){
        String email = request.getHeader("email");
        return JsonResult.success(_service.All(email));
    }
}
